<?php

namespace app\utils;

use WhiteHat101\Crypt\APR1_MD5;

class Md5
{
    public static function md5($str)
    {
        return  APR1_MD5::hash($str);
    }

    public static function md5Plus($str)
    {
        return  hash_file('md5',$str);
    }


    public static function createTokenStr()
    {
        $length = 30;
        $str = null;
        $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
        $max = strlen($strPol) - 1;

        for ($i = 0; $i < $length; $i++) {
            $str .= $strPol[rand(0, $max)];
        }

        return $str;
    }

}



